﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;

namespace JumpingMan
{
    class Mob
    {
        public int x;
        public int y;
        public Point direction;
        public Mob()
        {
        }
        public Mob(int x, int y, int k)
        {
            this.x = x;
            this.y = y;
            this.direction = new Point(k, -k);
        }

        public void MoveMob()
        {
            this.x += direction.X;
            this.y += direction.Y;
            if (this.x > 440)
            {
                this.x = 440;
                direction.X *= -1;
            }
            if (this.x < 0)
            {
                this.x = 0;
                direction.X *= -1;
            }
            if (this.y > 390)
            {
                this.y = 390;
                direction.Y *= -1;
            }
            if (this.y < 0)
            {
                this.y = 0;
                direction.Y *= -1;
            }

        }
        public void DrawMob(Graphics imageGraphics)
        {
            Rectangle rect = new Rectangle(this.x, this.y, 10, 10);
            imageGraphics.FillRectangle(new SolidBrush(Color.Black), rect);
        }
        public void CheckForCollision(Player player)
        {
            for (int i = 0; i < 10; i++)
            {
                for (int g = 0; g < 10; g++)
                {
                    if (this.x + i == player.x && this.y + g == player.y)
                    {
                        MessageBox.Show("GAME OVER");
                    }
                }
            }
        }
    }
}
